import {request} from "../request.js"
import {requestUpload} from "../uploadImgFile"
import api from "../api.js"

// 登录
export function login(data){
    return  request(api.loginUrl,"POST",data)
}
// 商家经营数据统计
export function getBusinessStatistics(data){
    return  request(api.businessStatistics,"GET",data)
}
// 商家营收统计
export function getBusinessUserRevenue(data){
    // begin,end
    let url=api.businessUserRevenue+"?begin="+data.begin+"&end="+data.end
    return  request(url,"GET",data)
}
// 查询员工信息
export function getEmployee(data){
    return  request(api.employeeUrl,"POST",data)
}
// 添加员工2 修改1
export function addEmployee(data,type){
    let url = (type == 2)? api.newAddEmpUrl : api.changeEmpUrl
    // data.employeeId=data.employeeId ?data.employeeId:""
    // console.log("嘿嘿",data)
    return  request(url,"POST",data)
}
// 订单查询
export function selectOrder(data){
    return request(api.selectOrderUrl,"POST",data)
}
//取消订单
export function cancelOrder(data){
    return request(api.cancelOrderUrl,"POST",data)
    
}
// 待付款 修改价格
export function toChangePrice(data){
    return request(api.changePriceUrl,"POST",data)
}
// 工单 追加 预约信息
export function addAppointmentToOrder(data,id){
    let url
    if(id == 1){
       url=api.undateAppointMentOrder
    }else if(id == ""){
        url = api.addAppointmentToOrder
    }
    return request(url,"POST",data)
}
// 上传营业执照
export function uploadImgFile(data){
    return requestUpload(api.unloadImgFileUrl,"POST",data,false)
}
// 获取企业类型
export function getEnterprisesType(data){
    return request(api.enterprisesTypeUrl,"GET",data)
}
// 商家入驻 注册
export function settleIn(data){
    return request(api.settleInUrl,"POST",data)
}
//获取验证码
export function getCode(data){
    return request(api.getCodeUrl+"?phone="+data,"GET",data)
}

// 验证码登陆
export function codeLogin(data){
    return request(api.loginByCode,"POST",data)
}

// 获取商家认证资料
export function getBusiness(data){
    return request(api.getBusinessInfo,"GET",data)
}
// 编辑商家认证资料
export function editBusiness(data){
    return request(api.changeBusiness,"POST",data)
}